{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-body">
        <form action="{:request()->url()}" class="layui-form" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">跳转链接</label>
                <div class="layui-input-inline">
                    <input type="text" name="url" class="layui-input" value="{$data.url|default=''}" placeholder="" autocomplete="off" >
                </div>
                <div class="layui-form-mid layui-word-aux">模板跳转链接</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">小程序</label>
                <div class="layui-input-inline">
                    <input type="text" name="appid" class="layui-input" value="{$data.appid|default=''}" placeholder="" autocomplete="off" >
                </div>
                <div class="layui-form-mid layui-word-aux">所需跳转到的小程序appid</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">跳转链接</label>
                <div class="layui-input-inline">
                    <input type="text" name="pagepath" class="layui-input" value="{$data.pagepath|default=''}" placeholder="" autocomplete="off" >
                </div>
                <div class="layui-form-mid layui-word-aux">所需跳转到小程序的具体页面路径，支持带参数</div>
            </div>

            {foreach name="field" item="r"}
            {if $r != 'remark'}
            <div class="layui-form-item">
                <label class="layui-form-label">{$r}</label>
                <div class="layui-form-mid layui-word-aux">值</div>
                <div class="layui-input-inline">
                    <input type="text" name="jdata[{$r}][value]" value="{$data['jdata'][$r]['value']|default=''}" autocomplete="off" placeholder=""  class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">文字颜色</div>
                <div class="layui-input-inline">
                    <div id="test{$r}"></div>
                    <input type="hidden" name="jdata[{$r}][color]" id="{$r}bgcolor" value="{$data['jdata'][$r]['color']|default=''}" autocomplete="off" placeholder="" class="layui-input">
                </div>
            </div>
            {else}
            <div class="layui-form-item">
                <label class="layui-form-label">{$r}</label>
                <div class="layui-form-mid layui-word-aux">值</div>
                <div class="layui-input-inline">
                    <textarea name="jdata[{$r}][value]" placeholder="" class="layui-textarea">{$data['jdata'][$r]['value']|default=''}</textarea>
                </div>
                <div class="layui-form-mid layui-word-aux">文字颜色</div>
                <div class="layui-input-inline">
                    <div id="test{$r}"></div>
                    <input type="hidden" name="jdata[{$r}][color]" id="{$r}bgcolor" value="{$data['jdata'][$r]['color']|default=''}" autocomplete="off" placeholder="" class="layui-input">
                </div>
            </div>
            {/if}
            {/foreach}
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-filter="i" lay-submit="">保存</button>
                    <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="js"}
<!--多图拖拽排序JS-->
<script type="text/javascript" src="/static/js/jquery-migrate-1.1.1.js"></script>
<script type="text/javascript" src="/static/js/jquery.dragsort-0.5.1.min.js"></script>
<script>
    laydate.render({
        elem: '#datetime'
        ,trigger:'click'
    });
    laydate.render({
        elem: '#start_time'
        ,trigger:'click'
    });
    laydate.render({
        elem: '#end_time'
        ,trigger:'click'
    });
    {foreach name="field" item="co"}
    layui.use('colorpicker', function(){
        var $ = layui.$
            ,colorpicker = layui.colorpicker;
            //头部背景色

            colorpicker.render({
                elem: '#test{$co}'
                ,color: "{$data['jdata'][$co]['color']|default='#000000'}"
                ,predefine: true // 开启预定义颜色
                ,colors: ['#e54d42','#f37b1d','#fbbd08','#8dc63f','#39b54a','#1cbbb4','#0081ff','#6739b6','#9c26b0','#e03997','#a5673f','#8799a3','#aaaaaa','#333333','#ffffff'] //自定义预定义颜色项
                ,change: function(color){
                //console.log(color)
                $('#{$co}bgcolor').val(color);
            }

        });
    });
    {/foreach}
</script>
{/block}